<?php
namespace app\admin\validate;

use think\Validate;

class StarValidate extends Validate
{
    protected $rule =   [
        'id'          => 'require|number',
        'name'        => 'require|length:1,30',
        'price'       => 'require|gt:0',
        'bonus_ratio' => 'require',
        'term_time'   => 'require',
    ];
    
    protected $message  =   [
        'id.require'          => 'ID必须',
        'id.number'           => 'ID必须是数字',
        'price.require'       => '价格不能为空',
        'price.gt'            => '价格必须大于0',
        'name.require'        => '名称不能为空',
        'name.length'         => '名称长度错误',
        'bonus_ratio.require' => '佣金比例不能为空',
        'term_time.require'   => '有效期不能为空',
    ];
    
    protected $scene = [
        'show'         => ['id'],
        'edit'         => ['id', 'name', 'price', 'bonus_ratio', 'term_time'],
    ];
}